using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Net.Fan.SmallPig.DataBase;

namespace Net.Fan.SmallPig.DataAccess
{
    public class ProProcesserDA
    {
        public static DataTable GetProProcesser(string proNo)
        {
            string sql = "select * from ProProcesser where ProNo =@ProNo";
            SqlParameter[] paras = new SqlParameter[1];
            paras[0] = new SqlParameter("@proNo", proNo);

            return DA_Base.RunReturnDataset(sql, paras).Tables[0];
        }

        public static void AddProProcesser(string proNo, string processer)
        {
            string sql = "insert into ProProcesser (ProNo,Processer) values (@ProNo ,@Processer)";
            SqlParameter[] paras = new SqlParameter[3];
            paras[0] = new SqlParameter("@proNo", proNo);
            paras[1] = new SqlParameter("@Processer", processer);

            DA_Base.ExecuteNonQuery(sql, paras);
        }

        public static int DeletetProProcesser(string proNo, string processer)
        {
            string sql = "delete from ProProcesser where proNo =@proNo and Processer =@Processer";
            SqlParameter[] paras = new SqlParameter[2];
            paras[0] = new SqlParameter("@ProNo", proNo);
            paras[1] = new SqlParameter("@Processer", processer);

            return DA_Base.ExecuteNonQuery(sql, paras);
        }



        public static int DeletetProProcesser(string proNo)
        {
            string sql = "delete from ProProcesser where proNo =@proNo";
            SqlParameter[] paras = new SqlParameter[1];
            paras[0] = new SqlParameter("@ProNo", proNo);

            return DA_Base.ExecuteNonQuery(sql, paras);
        }
    }
}
